package tests;

import common.Utils;
import org.openqa.selenium.By;

import java.io.IOException;

public class homePage extends Utils {
    public static String url="http://49.235.61.184:8080/home";

    public homePage()
    {

        super(url);
    }

    //首页进入失败----用户未登录时，进入问卷考试系统首页----跳转到用户登录页面
    public  void homeFail() throws IOException {
        String curUrl = driver.getCurrentUrl();
        assert curUrl.equals("http://49.235.61.184:8080/user/login");

        //屏幕截图
        getScreenShot(Thread.currentThread().getStackTrace()[1].getMethodName());
    }


    //首页进入成功----用户登录状态下
    public void homeSucc() throws IOException {
        Utils.login();
        //查看首页各个部分
        //首页标题
        //问卷数/考试数
        //创建问卷/考试按钮
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-heading"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div.extraContent___3rMo7 > div:nth-child(1) > div"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div.extraContent___3rMo7 > div:nth-child(2) > div > div.ant-statistic-content"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(1)"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(2)"));

        //屏幕截图
        getScreenShot(Thread.currentThread().getStackTrace()[1].getMethodName());

    }


}
